home *** CD-ROM | disk | FTP | other *** search
/ Holt Researcher: American History / Holt Researcher: American History.iso / pc / modules / search.dxr / 00110_scroll to end subclass.ls < prev    next >
Encoding:
Text File  |  2000-01-18  |  2.2 KB  |  85 lines

  1. property ancestor, pTextChannel, pSelectionSprite, pSelection, pMember, pLineHeight, pVisibleLines
  2.  
  3. on new me, bedChannel, textChannel, selectionChannel, descendant
  4.   pBedChannel = bedChannel
  5.   pTextChannel = textChannel
  6.   pSelectionSprite = selectionChannel
  7.   pSelection = 0
  8.   pMember = the member of sprite textChannel
  9.   pLineHeight = the textHeight of member pMember
  10.   pVisibleLines = integer(float(member(pMember).pageHeight) / pLineHeight)
  11.   minVal = 1
  12.   maxVal = max(1, the number of lines in field pMember - 1)
  13.   value = 1
  14.   if voidp(descendant) then
  15.     descendant = me
  16.   end if
  17.   ancestor = new(script("scroll bar"), bedChannel, textChannel, minVal, maxVal, value, pVisibleLines, descendant)
  18.   return me
  19. end
  20.  
  21. on Inscope me
  22.   puppetSprite(pSelectionSprite, 1)
  23.   Inscope(ancestor)
  24. end
  25.  
  26. on outScope me
  27.   puppetSprite(pSelectionSprite, 0)
  28.   outScope(ancestor)
  29. end
  30.  
  31. on adjustScrollbar me
  32.   setSelection(me, 0)
  33.   SetNumSettings(me, max(1, the number of lines in field pMember - pVisibleLines + 1))
  34. end
  35.  
  36. on setThumb me, NewSetting
  37.   if NewSetting < me.pMin then
  38.     NewSetting = me.pMin
  39.   end if
  40.   if NewSetting > me.pMax then
  41.     NewSetting = me.pMax
  42.   end if
  43.   setThumb(ancestor, NewSetting)
  44.   updateSelection(me)
  45. end
  46.  
  47. on performFunction me
  48.   member(pMember).scrollTop = pLineHeight * (me.pSetting - 1)
  49.   updateSelection(me)
  50. end
  51.  
  52. on setSelection me, selection
  53.   pSelection = selection
  54.   updateSelection(me)
  55. end
  56.  
  57. on getSelection me
  58.   return pSelection
  59. end
  60.  
  61. on updateSelection me
  62.   if pSelection = 0 then
  63.     set the locV of sprite pSelectionSprite to -9999
  64.   else
  65.     lineLoc = linePosToLocV(member(pMember), pSelection) + the top of sprite pTextChannel - member(pMember).scrollTop + integer(member(pMember).margin / 2)
  66.     top = the top of sprite pTextChannel
  67.     bot = the bottom of sprite pTextChannel
  68.     height = the height of sprite pSelectionSprite
  69.     if (lineLoc >= top) and ((lineLoc + height) <= bot) then
  70.       set the locV of sprite pSelectionSprite to lineLoc
  71.     else
  72.       set the locV of sprite pSelectionSprite to -9999
  73.     end if
  74.   end if
  75.   updateStage()
  76. end
  77.  
  78. on GetHiliteAdjustment me, clickedLine
  79.   if the machineType = 256 then
  80.     return 4 - (clickedLine * 2)
  81.   else
  82.     return 0
  83.   end if
  84. end
  85.